package com.ls.controller.team;

import com.ls.controller.team.model.AddTeamModel;
import com.ls.controller.team.model.EditTeamModel;
import com.ls.controller.team.model.QueryTeamModel;
import com.ls.service.ITeamService;
import com.ls.utils.ResultData;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 分组表，与customer关联 前端控制器
 * </p>
 * 需要加一个分组表，用户和分组是一对多的关系
 * @author pengyu
 * @since 2024-11-20
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/groupApp")
@Api(value = "app分组", tags = "app分组")
public class TeamAppController {
    private final ITeamService service;

    /** 分组 */
    @GetMapping(value = "pageList")
    public ResultData pageList(QueryTeamModel model) {
        return service.pageList(model);
    }

    /** 新增分组 */
    @PostMapping(value = "add")
    public ResultData add(@Valid @RequestBody AddTeamModel model) {
        return service.add(model);
    }

    /** 编辑分组 */
    @PostMapping(value = "edit")
    public ResultData edit(@Valid @RequestBody EditTeamModel model) {
        return service.edit(model);
    }

    /** 删除分组 */
    @PostMapping(value = "del")
    public ResultData del(@RequestParam Integer groupId) {
        return service.del(groupId);
    }
}
